package com.woniuxy.carrental.controller;

import com.woniuxy.carrental.entity.CommonUtil;
import com.woniuxy.carrental.entity.Reporting;
import com.woniuxy.carrental.service.ReportingService;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * @author author
 * @create 2021-09-29 23:25
 * 肖某的定损controller
 */
@CrossOrigin  //解决跨域
@RestController  //要求返回json格式数据异步使用
public class ReportingController {

    //获取service实例
    @Resource
    ReportingService reportingService;

    //使用分页查询动态SQL
//    @RequestMapping("/loss")
//    public ResponseResult<PageBean<Loss>> fenyeLoss(Loss loss,int pageSize,int pageIndex){
//      return lossService.selectLossByPageService(loss, pageIndex, pageSize);
//    }

    //新增定损名单：
    @GetMapping("/reportingcontroller")
    public String addreportingcontroller(Reporting reporting){
       reporting.setReportingid(CommonUtil.uuid());
        System.out.println(reporting);
        reportingService.addReportingService(reporting);
        return "添加成功";
    }

    //修改定损名单
//    @PostMapping("/loss")
//    public String updataLo(Loss loss){
//        lossService.updataLossService(loss);
//        return "修改成功";
//    }

    //删除定损名单
//    @DeleteMapping("/loss")
//    public String delete(int id){
//        lossService.deleteLossService(id);
//        return "删除成功";
//    }
    //查询所有数据
//    @GetMapping("selectAll")
//    public List<Loss> selectAddController(){
//        return lossService.selectAllLossService();
//    }
}
